﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.ServiceModel;

namespace SmartSpace.WpfShell
{
    /// <summary>
    /// Interaction logic for LoginWindow.xaml
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            InitializeComponent();
        }

        private void _ctlBtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            ServiceRef.SsWebService client = App.GetProxy();
            client.LoginCompleted+=new ServiceRef.LoginCompletedEventHandler(client_LoginCompleted);
            client.LoginAsync(_ctlUserId.Text, "sss");
        }

        void client_LoginCompleted(object sender, ServiceRef.LoginCompletedEventArgs e)
        {
            if (e.Error==null && e.Result.IsSuccess)
            {
                DialogResult = true;
            }
            else
            {
                MessageBox.Show(e.Result.Message, "出错", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
    }
}
